package com.mt.components.general {
	import com.mt.components.log.LogFactory;
	import com.mt.components.log.Logger;
	import com.mt.components.utils.StringUtils;
	
	import mx.controls.ButtonBar;
	
	/**      
	 * 文件名称：MButtonBar<br>
	 * 文件描述：<br>
	 * 创建人：马腾<br>
	 * 创建时间：Nov 25, 2012 1:09:21 AM<br>
	 * 修改人：马腾<br>
	 * 修改时间：Nov 25, 2012 1:09:21 AM<br>
	 */
	public class MButtonBar extends ButtonBar {
		
		private static var logger:Logger = LogFactory.getLogger(MButtonBar);
		
		public function MButtonBar() {
			super();
		}
		
		override public function itemToLabel(data:Object):String {
			var str:String = super.itemToLabel(data);
			if(StringUtils.isEmpty(str)){
				var arr:Array = labelField.split(".");
				if(arr){
					var cache:Object = data;
					for (var i:int=0; i<arr.length; i++){
						cache = cache[arr[i]];
					}
				}
				return cache.toString();
			}
			return str;
		}
	}
}